class AbstractWorkflowController {
    
    def index = { redirect(action:list,params:params) }

    // the delete, save and update actions only accept POST requests
    def allowedMethods = [delete:'POST', save:'POST', update:'POST']

    def list = {
        if(!params.max) params.max = 10
        [ abstractWorkflowList: AbstractWorkflow.list( params ) ]
    }

    def show = {
        def abstractWorkflow = AbstractWorkflow.get( params.id )

        if(!abstractWorkflow) {
            flash.message = "AbstractWorkflow not found with id ${params.id}"
            redirect(action:list)
        }
        else { return [ abstractWorkflow : abstractWorkflow ] }
    }

    def delete = {
        def abstractWorkflow = AbstractWorkflow.get( params.id )
        if(abstractWorkflow) {
            abstractWorkflow.delete()
            flash.message = "AbstractWorkflow ${params.id} deleted"
            redirect(action:list)
        }
        else {
            flash.message = "AbstractWorkflow not found with id ${params.id}"
            redirect(action:list)
        }
    }

    def edit = {
        def abstractWorkflow = AbstractWorkflow.get( params.id )

        if(!abstractWorkflow) {
            flash.message = "AbstractWorkflow not found with id ${params.id}"
            redirect(action:list)
        }
        else {
            return [ abstractWorkflow : abstractWorkflow ]
        }
    }

    def update = {
        def abstractWorkflow = AbstractWorkflow.get( params.id )
        if(abstractWorkflow) {
            abstractWorkflow.properties = params
            if(!abstractWorkflow.hasErrors() && abstractWorkflow.save()) {
                flash.message = "AbstractWorkflow ${params.id} updated"
                redirect(action:show,id:abstractWorkflow.id)
            }
            else {
                render(view:'edit',model:[abstractWorkflow:abstractWorkflow])
            }
        }
        else {
            flash.message = "AbstractWorkflow not found with id ${params.id}"
            redirect(action:edit,id:params.id)
        }
    }

    def create = {
        def abstractWorkflow = new AbstractWorkflow()
        abstractWorkflow.properties = params
        return ['abstractWorkflow':abstractWorkflow]
    }

    def save = {
        def abstractWorkflow = new AbstractWorkflow(params)
        if(!abstractWorkflow.hasErrors() && abstractWorkflow.save()) {
            flash.message = "AbstractWorkflow ${abstractWorkflow.id} created"
            redirect(action:show,id:abstractWorkflow.id)
        }
        else {
            render(view:'create',model:[abstractWorkflow:abstractWorkflow])
        }
    }
}
